package com.biodiv.community.config;

import com.alibaba.cloud.ai.dashscope.api.DashScopeApi;
import com.alibaba.cloud.ai.dashscope.api.DashScopeResponseFormat;
import com.alibaba.cloud.ai.dashscope.chat.DashScopeChatModel;
import com.alibaba.cloud.ai.dashscope.chat.DashScopeChatOptions;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author: tianquan
 * @date: 2025-07-14  11:54
 */
@Configuration
public class ChatClientFactory {

    @Bean
    public static ChatClient qwenPlusChatClient(DashScopeApi dashScopeApi) {

        DashScopeChatOptions customOptions = DashScopeChatOptions.builder()
                .withTopP(0.7)
                .withTopK(50)
                .withTemperature(0.8)
                .withModel("qwen-plus-2025-04-28")
                .build();

        DashScopeChatModel chatModel = new DashScopeChatModel(dashScopeApi, customOptions);

        return ChatClient.builder(chatModel)
                // 默认系统角色
                .defaultSystem("11")
                .build();

    }


}
